import json

def load_config(config_file='config.json'):
    """
    读取配置文件，返回当前使用的模型名称

    参数:
    config_file (str): 配置文件路径

    返回:
    str: 当前使用的模型名称
    """
    try:
        with open(config_file, 'r', encoding='utf-8') as file:
            config = json.load(file)
            file.close()
        # return config.get('model', 'gpt-4')
        return config
    except Exception as e:
        print(e)
        return None


# 按行读取文件，并返回文件的每一行
def read_file_line_by_line(file_path):
    lines = []
    with open(file_path, 'r', encoding='utf-8') as file:
        for line in file:
            lines.append(line.strip())
        file.close()
    return lines

if __name__ == "__main__":
    config_file = 'config.py'
    config = load_config(config_file)
    if config :
        print('model : ', config.get('model', 'aaa'))
    else:
        print('fial to load config file.')
    